<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="/common/base.jsp"%>
<%
	//实例化AreaDao
	FamilyDao familyDao = new FamilyDao();
	Join_nhDao join_nhDao = new Join_nhDao();
	int[] grades = { 1, 2, 3 };
	List<Family> familyList = familyDao.findFamilyList();
	System.out.println("join-nh====="+familyList);
	List<Join_nh> familyJoin_nhList = join_nhDao.findFamilyJoin_nhList();
	PayBaseDao payBaseDao = new PayBaseDao();
	System.out.println("join-nh==payBaseDao.findByYear().get(0).getMoney()==="+payBaseDao.findByYear().get(0).getMoney());
	Join_nh join_nh = new Join_nh();
	boolean status = join_nh.IsTime();
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<title>家庭档案信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/admin.js"></script>
<script src="js/chdj.js"></script>
<script type="text/javascript">
    function getkey(a) {
        var pms = document.getElementById("keywords").value;
	//	alert(pms);
  a.href = '<%=path%>/biz/Join_nhServlet?m=find&familycode=' + pms;
  }
function dj(a) {
        var label = document.getElementById("arr");
		var value = label.innerText.trim();	
  a.href = '<%=path%>/biz/Join_nhServlet?m=add&familyarr=' + value;
  }

</script>
<script type="text/javascript">
		$(function(){
//全选
			$("input[name='demo']").click(function(){
				var $isSelected = $(this).is(":checked");
				for(var i = 0;i<$("input[name='choice']").length;i++){
					$("input[name='choice']")[i].checked = $isSelected;
				}
			})
//选中行选中checkbox
			$("#table tr").slice(1).each(function(){
				var This = this;
				$(this).children().click(function(){
					$($(This).children()[3]).children().each(function(){
						if(this.type=="checkbox"){
							if(!this.checked){
								this.checked = true;
							}else{
								this.checked = false;
							}
						}
					});
				});
			});
		});
		// 有选中才提交
		function checkShopping(){
			$("#msg").html('');
			var $checkbox = $("input[name='choice']");
			for(var i = 0 ;i<$checkbox.length;i++){
				if(checkObj($checkbox[i])){
					return true;
				}
			}
			if(i==$checkbox.length){
				$("#msg").html('提示：至少选择1条信息!');
				return false;
			}
		}
		function checkObj(obj){
			if(obj.checked){
				return true;
			}else{
				return false;
			}
		}
	</script>
<style>
/*全选框样式*/
input[type="checkbox"]{width:20px;height:20px;display: inline-block;text-align: center;vertical-align: middle; line-height: 18px;position: relative;}
input[type="checkbox"]::before{content: "";position: absolute;top: 0;left: 0;background: #fff;width: 100%;height: 100%;border: 1px solid #d9d9d9}
input[type="checkbox"]:checked::before{content: "\2713";background-color: #fff;position: absolute;top: 0;left: 0;width:100%;border: 1px solid #E0BD62;color:#E0BD62;font-size: 20px;font-weight: bold;}
/*隐藏滚动条，功能不变*/
html::-webkit-scrollbar {display:none}

#box_relative {
  position: relative;
  left: 85%;
  top: 46px;
}
#relative {
  position: relative;
  left: 0%;
  top: 10px;
}
</style>

<style>
	#yangshi1{ font-weight:bold ;font-size:20px}
	#yangshi2{ font-weight:800}
</style>
</head>
<body>
	<form method="post" action="" id="listform">
		<div class="panel admin-panel">
			<div class="padding border-bottom">
			
				<ul class="search" style="padding-left:10px;">
					<li>
					
					<input type="text" placeholder="请输入搜索关键字" name="keywords" id="keywords"
						class="input" style="width:250px; line-height:17px;display:inline-block" list="family"/> 
						<datalist id="family" class="selectDate" aria-invalid="false"> 
							<%
						  for(Family m:familyList){ 
						
						  %>
							<option value="<%=m.getFamilycode()%>"><%=m.getFamilyname() %></option>
							<%} %>

						</datalist >
						<a href="" onclick="getkey(this)" 
						class="button border-main icon-search"
						onclick="changesearch()"> 搜索</a>
						<label style = "font-weight:bold">今年缴费标准金:￥<%=payBaseDao.findByYear().get(0).getMoney() %>元</label>
						<label style = "font-weight:bold">今年缴费标准金:￥元</label>
						<button class="button bg-red icon-share-square-o" type="button" onclick="window.history.go(-1)">返回</button>

						
						<c:if test="<%=status==true%>">
							<a class="button border-purple" >在参合时间内 </a>
						</c:if>
						<c:if test="<%=status!=true%>">
							<a class="button border-purple"  >不在在参合时间内，不可以参合 </a>
						</c:if>
						
					</li>
				</ul>
				
			</div>
			
			<table class="table table-hover text-center">
				<tr>
					<th><input type="checkbox" id="allcheck"  onclick="demo()" />全选</th>
					<!-- <th>行政区域</th> -->
					<th>农合证号</th>
					<th>家庭编码</th>
					<th>姓名</th>
					<th>身份证号码</th>
					<th>与户主关系</th>
					<th>年龄</th>
					<th>职业</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${list}" var="item">
				<tr>
					<c:if test="${'已参合' != item.ch_year}">
                    	<td><input type="checkbox" name="choice" class="checknum"  onclick="setAll()"
					value="${item.join_nh_code}" /></td>
                	</c:if>
                	<c:if test="${'已参合' == item.ch_year}">
                    	<td></td>
                	</c:if>
					<td>${item.join_nh_code}</td>
					<td>${item.familycode}</td>
					<td>${item.membername}</td>
					<td>${item.IDcard}</td>
					<td>${item.relation}</td>
					<td>${item.age}</td>
					<td>${item.occupation}</td>
					<c:if test="${'已参合' == item.ch_year}">
                    	<td style="color: green; font-weight:bold ;">已参合</td>
                	</c:if>
                	<c:if test="${'已参合' != item.ch_year}">
                    	<td style="color: red; font-weight:bold ;">未参合</td>
                	</c:if>
                	<td>
                	<input type="hidden" name="money" class="money" id="money" value="<%=payBaseDao.findByYear().get(0).getMoney() %>" />
					</td>
						<td>
						<a class="button border-red" href="<%=path%>/biz/Join_nhServlet?m=sign&join_nh_code=${item.join_nh_code}">
							<span class="icon-plus-square-o"></span>登记</a>
						</td>
					<%-- <td>${item.ch_year}</td> --%>
				</c:forEach>
			</table>
		</div>
	</form>
	<label id="arr" name="arr"></label>
	<div id="relative">
		<li><a class="button border-red"  >参合费用:￥<label
				id="show" class="yangshi2">0</label>元
		</a></li>
	</div>
<%--	<div id="box_relative">--%>
<%--		<li>--%>
<%--		<c:if test="<%=status==true%>">--%>
<%--             <a href="" onclick="dj(this)" id="yangshi1" class="button border-green icon-plus-square-o" > 登记</a>--%>
<%--        </c:if>--%>

<%--		<!--  <a id="yangshi1" class="button border-green icon-plus-square-o" onclick="dj()">登记</a> -->--%>
<%--		</li>--%>
<%--	</div>--%>

</body>
</html>
